#ifndef _WX_OPENGL_H_
#define _WX_OPENGL_H_


#include "wx/glcanvas.h"

namespace FemViewer {
class ViewManager;
class ModelCtrl;

namespace WxGUI		{


class wxMainWindow;

class wxRenderCanvas : public wxGLCanvas
{
public:
	wxRenderCanvas(ModelCtrl* pmodel,
		           ViewManager* pview,
		           wxMainWindow* parent,
			 	   wxWindowID id = wxID_ANY,
			 	   int* gl_attrib = NULL,
			 	   const wxPoint& pos = wxDefaultPosition,
			 	   const wxSize& size = wxDefaultSize,
			 	   long style = 0,
			 	   const wxString& name = wxT("FemViewer"));
	~wxRenderCanvas();
	void CleanUp();
	
protected:
	void OnPaint(wxPaintEvent& event);
	int  Modifires(wxMouseEvent& event);
	void OnSize(wxSizeEvent& event);
	void OnEraseBackground(wxEraseEvent& event);
	void OnMouseMove(wxMouseEvent& event);
	void OnLeftBtnDown(wxMouseEvent& event);
	void OnLeftBtnUp(wxMouseEvent& event);
	void OnMiddleBtnDown(wxMouseEvent& event);
	void OnMiddleBtnUp(wxMouseEvent& event);
	void OnRightBtnDown(wxMouseEvent& event);
	void OnRightBtnUp(wxMouseEvent& event);
	//void OnMouse(wxMouseEvent& event);
	void OnMouseWheel(wxMouseEvent& event);
	
	void OnEnterWindow(wxMouseEvent& event);
	/*void GetViewportOffset() const;*/
	
	

private:
	void InitGL();

	ModelCtrl		*m_ptrModel;
	ViewManager		*m_pview;
	wxMainWindow	*m_ptrWnd;
	wxGLContext		*m_ptrRC;
	bool 			 m_bInitGL;
	int 			 m_ndraging;
	
	
	DECLARE_NO_COPY_CLASS(wxRenderCanvas);
	DECLARE_EVENT_TABLE()

};

}// end namespace WxGUI
}// end namespace FemViewer


#endif /* _WX_OPENGL_H_
*/

